package com.scott.classicthreadmodal.demo2.storage;

import com.scott.classicthreadmodal.Product;

import java.util.List;

/**
 * 仓库执行方法
 */
public class StorageExecutor implements IStorage {

    private IStorage iStorage;

    public StorageExecutor(IStorage iStorage) {
        this.iStorage = iStorage;
    }

    @Override
    public void produce(int num, String producerName) throws InterruptedException {
        iStorage.produce(num, producerName);
    }

    @Override
    public List<Product> consume(int num, String consumerName) throws InterruptedException {
        return iStorage.consume(num, consumerName);
    }

    @Override
    public int getStock() {
        return iStorage.getStock();
    }
}
